package api

import request "gitee.com/changeden/volcengine-livesaas-request-go"

type PollingChatRequest struct {
	ActivityId  *int64 `json:"ActivityId"`
	ChatId      *int64 `json:"ChatId"`
	Count       *int32 `json:"Count"`
	PollingType *int32 `json:"PollingType"`
}
type PollingChatResponse struct {
	Data []ChatData `json:"Data" gorm:"column:Data"`
}
type ChatData struct {
	User         ChatUser `json:"User" gorm:"column:User"`
	CreateTime   int64    `json:"CreateTime" gorm:"column:CreateTime"`
	IsDelete     bool     `json:"IsDelete" gorm:"column:IsDelete"`
	ReviewStatus int32    `json:"reviewStatus" gorm:"column:reviewStatus"`
	TextContent  string   `json:"TextContent" gorm:"column:TextContent"`
	LikeCount    int32    `json:"LikeCount" gorm:"column:LikeCount"`
	IsPresenter  bool     `json:"IsPresenter" gorm:"column:IsPresenter"`
	ChatID       int64    `json:"ChatId" gorm:"column:ChatId"`
}
type ChatUser struct {
	UserID   int64  `json:"UserId" gorm:"column:UserId"`
	Nickname string `json:"Nickname" gorm:"column:Nickname"`
}

func (instance *Instance) PollingChat(data *PollingChatRequest) (*PollingChatResponse, error) {
	d := request.Data{
		Action: "PollingChatAPI",
	}
	bindQuery(&d, *data)
	var res PollingChatResponse
	err := instance.get(&d, &res)
	return &res, err
}
